package com.yy.fourth.configuration;

import com.yy.fourth.interceptor.GlobalInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author yangyao
 * @Description: 拦截器配置
 * @date 2018/10/19 09:01
 */
@Configuration
public class InterceptorConfiguration extends WebMvcConfigurerAdapter {
    @Autowired
    private GlobalInterceptor globalInterceptor;

    /**
     * 添加自定义拦截器信息
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(globalInterceptor).addPathPatterns("/**");
    }
}
